package com.usian.article.service.impl;

import com.usian.article.mapper.ApArticleConfigMapper;
import com.usian.article.mapper.ApArticleContentMapper;
import com.usian.article.mapper.ApArticleMapper;
import com.usian.article.service.ApArticleService;
import com.usian.model.article.pojos.ApArticle;
import com.usian.model.article.pojos.ApArticleConfig;
import com.usian.model.article.pojos.ApArticleContent;
import com.usian.model.base.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author xiaowanmate
 * @date 2023/2/24 10:42
 */
@Service
public class ApArticleServiceImpl extends BaseServiceImpl<ApArticleMapper,ApArticle> implements ApArticleService {

    @Autowired
    private ApArticleContentMapper contentMapper;

    @Autowired
    private ApArticleConfigMapper configMapper;

    @Override
    public ApArticle saveArticle(ApArticle article) {
        if(article == null)return null;
        save(article);
        return article;
    }

    @Override
    public ApArticleConfig saveArticleConfig(ApArticleConfig config) {
        if(config == null) return null;
        configMapper.insert(config);
        return config;
    }

    @Override
    public ApArticleContent saveArticleContent(ApArticleContent content) {
        if(content == null) return null;
        contentMapper.insert(content);
        return content;
    }
}
